package com.fzz.learnitservice.pojo.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum EnglishLevelEnum implements BaseEnum {
    PRIMARY(1, "小学"),
    JUNIOR(2, "初中"),
    SENIOR(3, "高中"),
    CET4(4, "CET-4"),
    CET6(5, "CET-6"),
    TEM4(6, "TEM-4"),
    TEM8(7, "TEM-8"),
    POSTGRADUATE(8, "考研"),
    IELTS(9, "雅思"),
    TOEFL(10, "托福");

    @EnumValue
    private final int code;
    private final String desc;

    public static EnglishLevelEnum fromCode(Integer code) {
        if (code == null) return CET4;
        for (EnglishLevelEnum e : values()) {
            if (e.getCode() == code) return e;
        }
        return CET4;
    }
}

